﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using WBasicClassLib.CodeTimer;

namespace CodeTimer_Sample
{
    class TestThreading : IAction
    {
        public void Action()
        {
            Thread.Sleep(1000);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int iteration = 10000;
            string s = "";
            CodeTimer.Time("String Concat", iteration, () => {s += "a";});
            StringBuilder sb = new StringBuilder();
            CodeTimer.Time("StringBuilder Concat", iteration, () => { sb.Append("a"); });

            CodeTimer.Time("(Interface)Thread Sleep", 1, new TestThreading());

            CodeTimer.Time("(delegate)Empty Loop", 1, delegate() { for (int i = 0; i < 10000000; ++i);});

            Console.ReadLine();
        }
    }
}
